'use strict';

const Controller = require('../../core/common');

class IntegralsController extends Controller {

  async index() {

    const { ctx } = this;

    const { userId } = ctx.params;

    const params = {
      where: {
        userId
      }
    }

    const data = await ctx.service.v1.integrals.findAll(params);

    this.success(data);
  }

  async show() {

    const { ctx } = this;

    const { userId } = ctx.params;

    const params = {
      where: {
        userId
      }
    }

    const data = await ctx.service.v1.integrals.findAll(params);

    this.success(data);
  }

  async create() {

    const { ctx } = this;

    const data = await ctx.service.v1.integrals.create();

    this.success(data)
  }

  async show() {

    const { ctx } = this;

    const { id } = ctx.params;

    const data = await ctx.service.v1.integrals.findById(id);

    this.success(data);
  }
}

module.exports = IntegralsController;